﻿@using Masa.Auth.Web.Sso.Pages.Account.Login.RegisterSections
@inherits SsoCompontentBase
@inject IJSRuntime _js
@inject EnvironmentDataService _environmentData

<MForm Model="_inputModel" @ref="_registerForm" EnableValidation EnableI18n class="mt-6 pt-6 px-12 text-center" Style="height: 430px; overflow: auto;">
    @foreach (var registerItem in _registerComponents.Values)
    {
        <DynamicComponent Type="@registerItem.ComponentType" Parameters="@registerItem.ComponentParameters" />
    }

    @*https://github.com/BlazorComponent/MASA.Blazor/issues/811*@
    <MCheckbox @bind-Value="_inputModel.Agreement" Class="mt-1" HideDetails="true" TValue="bool">
        <LabelContent>
            @T("RegistrationAgreementStatement")
            <span @onclick="_ => _protocolModalVisible = true" @onclick:preventDefault @onclick:stopPropagation style="color:rgb(0,0,238);">《@T("RegistrationAgreement")》</span>
        </LabelContent>
    </MCheckbox>
</MForm>
<div class="text-center mt-3">
    <MButton Class="rounded-pill text-btn white--text" Disabled=!CanRegister
             OnClick="RegisterHandler" Height=48 Width=340 Color="primary" Loading="_registerLoading">
        @T("Register")
    </MButton>
</div>
<ProtocolModal @bind-Visible="_protocolModalVisible" OnSuccess="ProtocolModalOnSuccess" OnClose="ProtocolModalOnClose" />